<?php

namespace Admin\Controller;

class OtherController extends AdminController {

    public function system() {
        $id = I("id", 0, 'intval');
        if (IS_POST) {
            $data['head_imgurl'] = I("img_url");
            $data['nick_name'] = I("nick_name");

            if (strpos($data['head_imgurl'], 'http') !== false) {
                
            } else {
                $data['head_imgurl'] = 'https://' . $_SERVER['HTTP_HOST'] . __ROOT__ . $data['head_imgurl'];
            }
            $res = M('Users')->where(array('user_id' => 0))->save($data);

            if ($res) {
                $this->success('操作成功');
            } else {
                $this->error('操作失败');
            }
        } else {
            $data = M('Users')->where(array("user_id" => 0))->find();

            $this->assign('data', $data);
            $this->assign('meta_title', '官方账号头像');
            $this->display();
        }
    }

}
